package com.weijie.relaxed.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.os.Handler;

import com.weijie.relaxed.R;

/** 
 * @author weijie 
 * @version 创建时间：2015年3月19日 上午10:15:03 
 */
public class WelcomeActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_welcome);
		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				
				SharedPreferences share = getSharedPreferences("user", Context.MODE_PRIVATE);
				String name = share.getString("username", "");
				String password = share.getString("password", "");
				if(!name.equals("") && !password.equals("")) {
					startActivity(new Intent(WelcomeActivity.this,MainActivity.class));
					finish();
				} else {
					startActivity(new Intent(WelcomeActivity.this,LoginActivity.class));
					finish();
				}
			}
		},2000);
	}

}
